Post

Replies

Boosts

Views

Activity

Reply to List sections empty after adding .id()
Although @snuff4's answer solved the empty cells issue in my real project, scrolling to desired cell/row wasn't working when using ScrollViewReader's scrollTo method. I have come up with a weird fix that works for me. It is weird because I don't know how and why it works, but it works. If anyone can explain why it works, I'll be very thankful. The solution is, I created a new ViewModifier named EmbedInSection that just embeds the content in Section. struct EmbedInSection: ViewModifier { func body(content: Content) -> some View { Section { content } } } And I used it like: var body: some View { List { ForEach(intervals) { interval in Text(interval.name) .id(interval.id) .modifier(EmbedInSection()) } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Feb ’22
Reply to IntentDonationManager not donating Shortcuts
I am also facing this same issue
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
May ’23
Reply to List sections empty after adding .id()
Although @snuff4's answer solved the empty cells issue in my real project, scrolling to desired cell/row wasn't working when using ScrollViewReader's scrollTo method. I have come up with a weird fix that works for me. It is weird because I don't know how and why it works, but it works. If anyone can explain why it works, I'll be very thankful. The solution is, I created a new ViewModifier named EmbedInSection that just embeds the content in Section. struct EmbedInSection: ViewModifier { func body(content: Content) -> some View { Section { content } } } And I used it like: var body: some View { List { ForEach(intervals) { interval in Text(interval.name) .id(interval.id) .modifier(EmbedInSection()) } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Feb ’22